package p270jp.pxv.android.legacy.model;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.support.p024v4.media.C0261e;
import com.google.android.gms.actions.SearchIntents;
import java.util.Date;
import p104de.greenrobot.dao.AbstractDao;
import p104de.greenrobot.dao.Property;
import p104de.greenrobot.dao.internal.DaoConfig;

/* renamed from: jp.pxv.android.legacy.model.SearchHistoryDao */
/* loaded from: classes2.dex */
public class SearchHistoryDao extends AbstractDao<SearchHistory, Long> {
    public static final String TABLENAME = "SEARCH_HISTORY";

    /* renamed from: jp.pxv.android.legacy.model.SearchHistoryDao$Properties */
    /* loaded from: classes2.dex */
    public static class Properties {

        /* renamed from: Id */
        public static final Property f19081Id = new Property(0, Long.class, "id", true, "_id");
        public static final Property Query = new Property(1, String.class, SearchIntents.EXTRA_QUERY, false, "QUERY");
        public static final Property ContentType = new Property(2, String.class, "contentType", false, "CONTENT_TYPE");
        public static final Property CreatedAt = new Property(3, Date.class, "createdAt", false, "CREATED_AT");
    }

    public SearchHistoryDao(DaoConfig daoConfig) {
        super(daoConfig);
    }

    public static void createTable(SQLiteDatabase sQLiteDatabase, boolean z) {
        String str = z ? "IF NOT EXISTS " : "";
        sQLiteDatabase.execSQL("CREATE TABLE " + str + "\"SEARCH_HISTORY\" (\"_id\" INTEGER PRIMARY KEY ,\"QUERY\" TEXT NOT NULL ,\"CONTENT_TYPE\" TEXT NOT NULL ,\"CREATED_AT\" INTEGER NOT NULL );");
    }

    public static void dropTable(SQLiteDatabase sQLiteDatabase, boolean z) {
        StringBuilder c = C0261e.m12042c("DROP TABLE ");
        c.append(z ? "IF EXISTS " : "");
        c.append("\"SEARCH_HISTORY\"");
        sQLiteDatabase.execSQL(c.toString());
    }

    @Override // p104de.greenrobot.dao.AbstractDao
    public boolean isEntityUpdateable() {
        return true;
    }

    public SearchHistoryDao(DaoConfig daoConfig, DaoSession daoSession) {
        super(daoConfig, daoSession);
    }

    public void bindValues(SQLiteStatement sQLiteStatement, SearchHistory searchHistory) {
        sQLiteStatement.clearBindings();
        Long id = searchHistory.getId();
        if (id != null) {
            sQLiteStatement.bindLong(1, id.longValue());
        }
        sQLiteStatement.bindString(2, searchHistory.getQuery());
        sQLiteStatement.bindString(3, searchHistory.getContentType());
        sQLiteStatement.bindLong(4, searchHistory.getCreatedAt().getTime());
    }

    public Long getKey(SearchHistory searchHistory) {
        if (searchHistory != null) {
            return searchHistory.getId();
        }
        return null;
    }

    /* JADX WARN: Can't rename method to resolve collision */
    @Override // p104de.greenrobot.dao.AbstractDao
    public Long readKey(Cursor cursor, int i) {
        int i2 = i + 0;
        if (cursor.isNull(i2)) {
            return null;
        }
        return Long.valueOf(cursor.getLong(i2));
    }

    public Long updateKeyAfterInsert(SearchHistory searchHistory, long j) {
        searchHistory.setId(Long.valueOf(j));
        return Long.valueOf(j);
    }

    @Override // p104de.greenrobot.dao.AbstractDao
    public SearchHistory readEntity(Cursor cursor, int i) {
        int i2 = i + 0;
        return new SearchHistory(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)), cursor.getString(i + 1), cursor.getString(i + 2), new Date(cursor.getLong(i + 3)));
    }

    public void readEntity(Cursor cursor, SearchHistory searchHistory, int i) {
        int i2 = i + 0;
        searchHistory.setId(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)));
        searchHistory.setQuery(cursor.getString(i + 1));
        searchHistory.setContentType(cursor.getString(i + 2));
        searchHistory.setCreatedAt(new Date(cursor.getLong(i + 3)));
    }
}
